﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data;
using DTO;
using UTIL;

namespace DAO
{
    public class HinhThucKhuyenMaiDao
    {
        public static DTO.HinhThucKhuyenMaiDto LayHinhThucKhuyenMaiTheoID(int id)
        {
            SqlConnection cnn = DataConnector.MakeConnection();
            string sql = "Select * From HinhThucKhuyenMai where ID="+id;
            SqlCommand cmd = new SqlCommand(sql, cnn);
            SqlDataReader dr = cmd.ExecuteReader();
            DTO.HinhThucKhuyenMaiDto ht=new HinhThucKhuyenMaiDto();
            if(dr.Read())
            {
                ht.ID = (int)dr["ID"];
                ht.HinhThuc = (String)dr["hinhthuc"];
            }
            return ht;
        }
    }
}
